Skip to content

Add IPv6 support for IPBlocksInfo CRD#1422

Merged
wenqiq merged 4 commits into
vmware-tanzu:mainfrom
wenqiq:topic/wenqi/IPBlocksInfo-IPv6
May 21, 2026
Merged

Add IPv6 support for IPBlocksInfo CRD#1422
wenqiq merged 4 commits into
vmware-tanzu:mainfrom
wenqiq:topic/wenqi/IPBlocksInfo-IPv6

Conversation

@wenqiq
Copy link
Copy Markdown
Contributor

@wenqiq wenqiq commented May 2, 2026

Support VpcConnectivityProfile.Ipv6Blocks in IPBlocksInfo sync

Include paths from VpcConnectivityProfile.Ipv6Blocks into the same
externalIPBlockPaths set as ExternalIpBlocks during IPBlocksInfo
reconciliation. This ensures that external IPv6 IP blocks assigned
to a VPC connectivity profile have their CIDRs and IP ranges
surfaced in the IPBlocksInfo CR (ExternalIPCIDRs / ExternalIPRanges)
without requiring any CRD schema change.

TestDone:

1.Enable VpcIpv6 FSS, Restart proton service.Replace manager, Restart the Operator

service proton restart

2.Create an IPv6 IPBlock (at the global /infra level)

curl -sk -u "${NSX_USER}:${NSX_PASS}" \
  -X PUT \
  -H "Content-Type: application/json" \
  "${NSX_MANAGER}/policy/api/v1/infra/ip-blocks/test-ipv6-block-1" \
  -d '{
    "display_name": "test-ipv6-block-1",
    "cidrs": ["2001:db8::/32"],
    "ip_address_type": "IPV6",
    "visibility": "EXTERNAL"
  }'
68b7c507-37bd-483c-bd3b-b73fa83e06ae

3.Create a VPC Connectivity Profile

TGW_PATH="<transit_gateway_path from Step 2>"
EXT_BLOCKS='["<existing external ip block path>"]'  

curl -k -u "${NSX_USER}:${NSX_PASS}" \
  -X PUT \
  -H "Content-Type: application/json" \
  "${NSX_MANAGER}/policy/api/v1/orgs/${ORG}/projects/${PROJECT}/vpc-connectivity-profiles/test-profile-ipv6" \
  -d "{
    \"display_name\": \"test-profile-ipv6\",
    \"transit_gateway_path\": \"${TGW_PATH}\",
    \"external_ip_blocks\": ${EXT_BLOCKS},
    \"ipv6_blocks\": [\"/infra/ip-blocks/test-ipv6-block-1\"]
  }"

Retrieve the default VPC Connectivity Profile details
350a581e-5b84-4f9a-9e43-45ce5915b118

  1. Create VPC and Attachment
curl -k -u "${NSX_USER}:${NSX_PASS}" \
  -X PUT \
  -H "Content-Type: application/json" \
  "${NSX_MANAGER}/policy/api/v1/orgs/${ORG}/projects/${PROJECT}/vpcs/test-vpc-ipv6" \
  -d '{"display_name": "test-vpc-ipv6"}'

curl -k -u "${NSX_USER}:${NSX_PASS}" \
  -X PUT \
  -H "Content-Type: application/json" \
  "${NSX_MANAGER}/policy/api/v1/orgs/${ORG}/projects/${PROJECT}/vpcs/test-vpc-ipv6/attachments/default" \
  -d "{
    \"display_name\": \"default\",
    \"vpc_connectivity_profile\": \"/orgs/${ORG}/projects/${PROJECT}/vpc-connectivity-profiles/test-profile-ipv6\"
  }"
82cc7498-f3a3-485a-b9ec-8bc7738ea8f5

5.Create VPCNetworkConfiguration

kubectl apply -f - <<EOF
apiVersion: crd.nsx.vmware.com/v1alpha1
kind: VPCNetworkConfiguration
metadata:
  name: test-vpc-config-ipv6
spec:
  nsxProject: "/orgs/${ORG}/projects/${PROJECT}"
  vpc: "test-vpc-ipv6"
EOF
  1. Verify IPBlocksInfo update
81523f1a46969051fd859f1c4f6a0471

@wenqiq wenqiq marked this pull request as ready for review May 7, 2026 02:57
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 7, 2026

Codecov Report

❌ Patch coverage is 80.95238% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.94%. Comparing base (ff79596) to head (2a4b2db).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/nsx/services/ipblocksinfo/ipblocksinfo.go 80.00% 0 Missing and 4 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1422      +/-   ##
==========================================
- Coverage   77.02%   76.94%   -0.09%     
==========================================
  Files         156      156              
  Lines       22048    22061      +13     
==========================================
- Hits        16983    16974       -9     
+ Misses       3859     3858       -1     
- Partials     1206     1229      +23     
Flag Coverage Δ
unit-tests 76.94% <80.95%> (-0.09%) ⬇️
Files with missing lines Coverage Δ
pkg/nsx/services/nsxserviceaccount/cluster.go 80.61% <100.00%> (ø)
pkg/nsx/services/ipblocksinfo/ipblocksinfo.go 77.19% <80.00%> (-7.74%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wenqiq wenqiq changed the title [WIP]Add IPv6 support for IPBlocksInfo CRD Add IPv6 support for IPBlocksInfo CRD May 10, 2026
@wenqiq wenqiq requested review from TaoZou1 and yanjunz97 May 10, 2026 18:13
@wenqiq wenqiq force-pushed the topic/wenqi/IPBlocksInfo-IPv6 branch from b90dc50 to 3409afc Compare May 10, 2026 18:45
Copy link
Copy Markdown
Collaborator

@dantingl dantingl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add test done in commit message?

Comment thread pkg/nsx/services/ipblocksinfo/ipblocksinfo.go
Comment thread pkg/nsx/services/ipblocksinfo/ipblocksinfo.go Outdated
@wenqiq wenqiq force-pushed the topic/wenqi/IPBlocksInfo-IPv6 branch 4 times, most recently from 00eb219 to 4dcde75 Compare May 14, 2026 19:05
@yanjunz97
Copy link
Copy Markdown
Contributor

I notice one more change will need for this PR

switch *subnet.AccessMode {
case model.VpcSubnet_ACCESS_MODE_PUBLIC:
externalIPCIDRs = append(externalIPCIDRs, subnet.IpAddresses...)
case model.VpcSubnet_ACCESS_MODE_PRIVATE_TGW:
project := fmt.Sprintf("/orgs/%s/projects/%s", vpcInfo.OrgID, vpcInfo.ProjectID)
if project == s.defaultProject {
privateTGWIPCIDRs = append(privateTGWIPCIDRs, subnet.IpAddresses...)
}
}

Here we add Subnet cidr with privatetgw/public access mode to ipblocksinfo.
IPv6 cidrs are all public and has no access mode. So the logic here shall be updated to
loop the Subnet cidrs,

  • for ipv4, we keep this check for access mode
  • for ipv6 cidr, we shall append it to externalIPCIDRs

wenqiq added 2 commits May 17, 2026 01:27
Support VpcConnectivityProfile.Ipv6Blocks in IPBlocksInfo sync

Include paths from VpcConnectivityProfile.Ipv6Blocks into the same
externalIPBlockPaths set as ExternalIpBlocks during IPBlocksInfo
reconciliation. This ensures that external IPv6 IP blocks assigned
to a VPC connectivity profile have their CIDRs and IP ranges
surfaced in the IPBlocksInfo CR (ExternalIPCIDRs / ExternalIPRanges)
without requiring any CRD schema change.

Signed-off-by: Wenqi Qiu <wenqi.qiu@broadcom.com>
Signed-off-by: Wenqi Qiu <wenqi.qiu@broadcom.com>
@wenqiq wenqiq force-pushed the topic/wenqi/IPBlocksInfo-IPv6 branch from 4dcde75 to a590014 Compare May 16, 2026 17:31
yanjunz97
yanjunz97 previously approved these changes May 19, 2026
Copy link
Copy Markdown
Contributor

@yanjunz97 yanjunz97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a nit

Comment thread .gitignore Outdated
Signed-off-by: Wenqi Qiu <wenqi.qiu@broadcom.com>
Comment thread pkg/nsx/services/ipblocksinfo/ipblocksinfo.go
@poojav25
Copy link
Copy Markdown
Contributor

LGTM

Signed-off-by: Wenqi Qiu <wenqi.qiu@broadcom.com>
Copy link
Copy Markdown
Contributor

@yanjunz97 yanjunz97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wenqiq wenqiq merged commit 33a3e95 into vmware-tanzu:main May 21, 2026
2 checks passed
poojav25 added a commit to poojav25/nsx-operator that referenced this pull request May 21, 2026
Upstream landed two commits since the branch point (ff79596):
  - 214f2a5 Sync defaultIPv6PrefixLength from VPCNetworkConfiguration to Subnet(Set) (vmware-tanzu#1417)
  - 33a3e95 Add IPv6 support for IPBlocksInfo CRD (vmware-tanzu#1422)

Both upstream commits bumped nsxt and nsxt-mp to v0.0.0-20260506074423.
Our branch had already bumped nsxt to v0.12.1-0.20260517061842-508c01aec2fc
(May 17, newer) to get IpAddressType/Ipv6AllocationPrefixLength model fields
required for this PR.

Resolution: - nsxt: keep our v0.12.1-0.20260517061842-508c01aec2fc (newer, required for IPv6)
  - nsxt-mp: take upstream's v0.0.0-20260506074423-13747423203f (we had old March version)
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants